home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
STRINGS
/
PACKAGE6
/
REAL_STR.DOC
< prev
next >
Wrap
Text File
|
1990-07-25
|
2KB
|
44 lines
--------------------------------------------------------------------------
ChangeRealToString
--------------------------------------------------------------------------
declaration: procedure ChangeRealToString ( RealNumber:
real;
var ResultString:
TypeString);
purpose: This procedure changes a real number into a string.
preconditions: RealNumber must consist of only numerals with or without
a decimal and with or without a + or - sign in front of it.
ResultString._PackedArray has already been initialized from
1 to _MaxStringLength with blanks. ResultString._Length
is initialized with a 0.
postconditions: The correct string is returned with the characters filled
from 1 to ResultString._Length.
special cases: if the length of the string exceeds the maximum amount
of characters, only the maximum characters will be returned.
example: var
RealNumber:
real;
AString:
TypeString;
begin
.
.
.
readln (input, RealNumber);
ChangeRealToString (RealNumber, ResultString);
for Counter := 1 to AString._Length do
write (output, AString._PackedArray[Counter]);
.
.
.
end
--------------------------------------------------------------------------